package com.cci.kangdao.controller;

import com.alibaba.fastjson.JSON;
import com.cci.kangdao.dao.model.OcrOrderVehicleLicenseRecord;
import com.cci.kangdao.dto.BaseResponse;
import com.cci.kangdao.dto.request.OcrOrderVehicleLicenseRecordRequest;
import com.cci.kangdao.service.OcrOrderVehicleLicenseRecordTService;
import com.cci.kangdao.utilTool.JsonUtils;
import com.cci.kangdao.utilTool.ParameterTool;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.UnsupportedEncodingException;
import java.util.Map;

/**
 * @description:
 * @author: joe
 * @company: CTY
 * @since: 2023/11/8 15:57
 * @version: V1.0
 **/
@Controller
public class OcrOrderVehicleLicenseRecordTController {

    @Resource
    private OcrOrderVehicleLicenseRecordTService ocrOrderVehicleLicenseRecordTService;

    /**
     * 【智能索赔】【DBU工单】【IOS】【安卓】【BE】智能索赔数据存储
     * @param map
     * @return
     */
    @RequestMapping(value = "/ocrOrderVehicleLicenseRecordSave.aspx")
    @ResponseBody
    public BaseResponse ocrOrderVehicleLicenseRecordSave(HttpServletRequest request, HttpServletResponse response,@RequestParam Map<String,Object> map){
        try {
            map = ParameterTool.getParameterRequest(request, true);
            String paramStr = MapUtils.getString(map, "paramStr");
            if (StringUtils.isBlank(paramStr)) {
                return BaseResponse.error("请输入参数");
            }
            OcrOrderVehicleLicenseRecordRequest javaObject = JsonUtils.toJavaObject(paramStr.toString(), OcrOrderVehicleLicenseRecordRequest.class);
            return ocrOrderVehicleLicenseRecordTService.insert(javaObject);
        } catch (UnsupportedEncodingException e) {
            throw new RuntimeException(e);
        }
    }

}
